<template>
  <div>
    <div class="classify_con" ref="mScroll" style="border:0;margin: 0">
      <div class="classify_ad" style="position:relative;height:7.1rem; overflow: hidden;">
        <img v-if="detaileImg" v-lazy="detaileImg" style="height: 100%; margin: 0"/>
        <!--显示分类商品件数-->
        <div
          style="position:absolute;bottom:0;height:1.45rem;line-height: 1.45rem; overflow: hidden;background: rgba(4,4,4,0.3);width: 100%;padding:0 0.75rem;text-align: left;vertical-align: middle">
           <span style="display: inline-block;width: 0.7rem;vertical-align: middle">
            <img style="width: 100%;height: auto;margin:0" src="static/image/time.png" alt="">
           </span>
          <span style="display: inline-block;color: white;font-size: 0.6rem;margin-left: 0.2rem">
             活动时间：{{acticeTime}}
          </span>
        </div>
      </div>
      <regular-show-list :goodsList="goodsList" :finalListtow="finalListtow" :routerWay="{path:'regulardetail',
                query: {regularId:finalListtow.regularId,
                       regularPackageId : finalListtow.regularPackageId}}" :isDetailPage='true'>
      </regular-show-list>
    </div>
  </div>
</template>

<script>
  import RegularShowList from "../RegularShowList";
  import {mapMutations} from "vuex";
  import TimeOut from '@/real-components/TimeOutWatch'
  import {queryGoodsListNormal} from '@/utils/ReturnAxios'
  import  {translateDetailData}from '@/utils/TranslateDetailDate'
  export default {
    props: {
      item: {
        type: Object,
        default: () => {
        }
      },
      regularPackageList: {
        type: Object,
        default: () => {
        }
      },
      acticeTime: {
        type: String,
        default: ''
      }
    },
    data() {
      return {
        timer: null,
        domCount: 0,
        targetValue: 0,
        detaileImg: 'static/image/no_data_ad.png',
        regularPackageGoodsList: [],
        codeList: [],
        goodsList: [],
        finalListone: null,
        finalListtow: null
      }
    },
    components: {
      RegularShowList,
      TimeOut
    },
    methods: {
      _initData () {
        var data = this.regularPackageList
        this.detaileImg = data.mainImg ? JSON.parse(data.mainImg)[0] : ''
        this.regularPackageGoodsList = data.regularPackageGoodsList
        this.finalListtow = {
          regularId: data.regularId,
          regularPackageId: data.regularPackageId
        }
      },
      computedCodeList () {
        var regularPackageGoodsList = this.regularPackageGoodsList
        this.codeList = regularPackageGoodsList.map((item) => {
          return item.goodsCode
        })

      },
      async getGoodsInfo () {
        var codeList = this.codeList
        if (!codeList) {
          return
        } //当没有商品数据时结束方法
        var res = await queryGoodsListNormal({goodscodeList: codeList})
        res = res.data
        var goodsList = res.data[0]
        this.goodsList = goodsList //将数获得的数据进行转换
      },
    },
    created() {
      this._initData()
      this.computedCodeList()
      this.getGoodsInfo()
    },
    mounted() {

    },
    computed: {},
    watch: {}
  }
</script>

<style scoped>
  .classify_ad img {
    height: 7rem;
  }

  .cjy-time-box {
    padding: 1.5rem 0 0.5rem;
    display: block;
  }

</style>
